<!doctype html>
<html lang="CN">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            width: 100%;
            height: 100vh;
            border: 1px solid #000;
            margin: 0 auto;
            overflow-y: scroll;
        }

        .box>div {
            box-sizing: border-box;
            border: 1px solid #000;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 36px;
            margin-bottom: 2px;
        }
    </style>
</head>

<body>
    <div class="box"></div>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script src="../ryh.js"></script>
    <script>
        var arr = new Array(50).keys();
        list = Array.from(arr);
        each()
        $(".box").on("scroll", function (e) {
            if (e.target.scrollTop + e.target.offsetHeight >= e.target.scrollHeight) {
                list.push(arr);
                each()
            }
        })
        function each() {
            var str = $(".box").html()
            $.each(list, function (index) {
                str += '<div>移动端demo' + ($(".box div").length + index) + '</div>'
            })
            $(".box").html(str);
            ryh.waterfall(".box", {
                itemEle: "div",  //瀑布流子元素
                spacingWidth: 6,  //距离左右元素宽度
                spacingHieght: 12,  //距离下方元素高度
                colCount: 3,  //一行几列
                minHieght: "360",   //随机高度最小值
                maxHieght: "390"   //随机高度最大数
            })
        }
    </script>
</body>

</html>